package apiday02homework;

import java.util.Scanner;

//返回所有字符在字符串中出现的次数
public class PracticeMorningE {
    public static void main(String[] args) throws InterruptedException {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String line = scan.nextLine();
        long start = System.currentTimeMillis();
        for (int i = 0; i < line.length(); ++i) {
            int count = 0;
            for (int j = 0; j < line.length(); ++j) {
                if (line.charAt(i) == line.charAt(j)) {
                    count++;
                }
            }
            System.out.println("字符" + line.charAt(i) + "出现了" + count + "次");
            Thread.sleep(333);
        }
        long end = System.currentTimeMillis();
        System.out.println("耗时:" + (end - start) + "毫秒");
    }
}
